package com.qzf.test.model;

import com.qzf.test.utils.MapUtils;

import java.util.ArrayList;
import java.util.List;

public class Map {
    private Integer floorHeight;
    private List<Layer> list =new ArrayList<>();

    public Integer getFloorHeight() {
        return floorHeight;
    }

    public void setFloorHeight(Integer floorHeight) {
        this.floorHeight = floorHeight;
    }

    public List<Layer> getList() {
        return list;
    }

    public void setList(List<Layer> list) {
        this.list = list;
    }

    public void compareALL() {
        for (int i = 0; i < list.size(); i++) {
            Layer layer = list.get(i);
            Cell[][] cells = layer.getCells();
            for (int row = 0; row < cells.length; row++) {
                for (int col = 0; col < cells[row].length; col++) {
                    Cell cell = cells[row][col];
                    if (cell.getState() == 1) {
                        Brand brand = cell.getBrand();
                        boolean result = MapUtils.compare(brand, layer.getParent());
                        brand.setGray(result);
                    }
                }
            }
        }
    }
}
